{% extends "blog/base.html" %}
{% load blog_tags %}

{% block title %}Pyx{% endblock %}

{% block content %}
    {% if tag %}
        <h1 class="page-title">标签：{{ tag.name }}</h1>
    {% endif %}
    <div class="post-list">
    {% for post in posts %}
        <div class="title">
            <a href="{{ post.get_absolute_url }}">
                {{ post.title }}
            </a>
        </div>
{#        {{ post.tags.all|join:"; "}}#}
        <div class="date">
            {{ post.publish }} by {{ post.author }}
            <span class="tags">
{#                Tags:#}
                {% for tag in post.tags.all %}
                    <a href="{% url "blog:post_list_by_tag" tag.slug %}">
                        <span class="label label-info">
                            {{ tag.name }}
                        </span>
                    </a>
                    {% if not forloop.last %} &nbsp {% endif %}
                {% endfor %}
            </span>
        </div>

        <div class="post-body">
            {{ post.body|markdown|truncatewords_html:30 }}
            <div class="btn">
            <a class="btn btn-default btn-sm" href="{{ post.get_absolute_url }}">
                Continue reading >>
            </a>
            </div>
        </div>
    {% endfor %}
    {% include "pagination.html" with page=posts %}
{#    <p>{{ posts }}</p>#}
    </div>
    <h1 class="copyright">Welcome to visit my website © Pyx</h1>

{% endblock %}